package cn.com.nes.site.module.dao;

import cn.com.nes.common.util.Globals;
import cn.com.nes.common.util.HttpUtils;
import cn.com.nes.common.util.OssUtil;
import cn.com.nes.common.util.Page;
import cn.com.nes.site.controller.system.vo.DelPosterButtonInfoVO;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.service.system.h5.NewH5Service;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;

/*
#ACTIVITY_NAME#   高端技术产品全国巡回沙龙
#ENG_ACTIVITY_NAME# China's first micro-business exchange meeting
#ACTIVITY_DATE# 20xx/08/08
#PAGE2_CONTENT1#  欢迎使用我们的模板，模板使用说明如下：模板上的文字以及图片均可自行替换修改，页面可酌情使用，无用可删除，适用可复制多个页面。如有问题，可联系作者。
#PAGE2_CONTENT2# 如需代修改模板或其他高端定制设计服务，请联系设计师（服务须另外付费）。
#PAGE2_CONTENT3# 在此祝您身体健康，事业红红火火！
#DEP_NAME#  产 品 研 发 部|市 场 招 商 部

#PAGE3_COMP#  X业简介 | Company Introduction
#PAGE3_COMPPIC#
#PAGE3_COMP_CONTENT#
*/





@Repository
public class H5DaoImpl extends BaseConnDaoImpl {

	@Resource
	private NewH5Service newH5Service;

	public PageData getScene(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String uuid = (String)req.getReqData().get("uuid") ;
			uuid = "uuidnes001" ;
			sb.delete(0, sb.length());
			sb.append(" SELECT content from  t_scene where uuid= ? ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {uuid});
			if(list.size()==1) {
				String content = (String)list.get(0).get("content") ;
				sb.delete(0, sb.length()) ;
				sb.append(" SELECT `name`,`value` from  t_scene_param where uuid= ? ") ;
				List<Map<String, Object>> listparam = this.queryForList(conn,sb.toString(),new Object[] {uuid});
				for(int i=0;i<listparam.size();i++) {
					String name = (String)listparam.get(i).get("name") ;
					String value = (String)listparam.get(i).get("value") ;
					content = content.replaceAll(name, value) ;
				}

//				JSONObject jsonObject = JSONObject.parseObject(content); 
//				JSONArray page = jsonObject.getJSONArray("list");
//				for(int i=0;i<page.size();i++) {
//					JSONObject  item = (JSONObject)page.get(i) ;
//					//System.out.println(JsonUtil.getStriFromObj(item));
//					
//				}
				//System.out.println(content);
				//String encodedStr = java.util.Base64.getEncoder().encodeToString(content.getBytes("UTF-8"));	
				String encodedStr = DatatypeConverter.printBase64Binary(content.getBytes("UTF-8"));
				res.setDatas(encodedStr);
			}
			res.setRetCode(0);
			res.setRetMessage("OK");
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData addUsers(Connection conn,DataReq req) {
		Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		param.put("tableName", "active_user");
		Map<String, Object> active_info = (Map<String, Object>) param.get("active_info") ;
		param.put("activityUuid", req.getReqData().get("id"));
		param.put("companyId", active_info.get("companyId")) ;
		param.put("yhlb", "02") ;
		try {
			String unionid = (String)req.getReqData().get("unionid") ;
			String phone = (String)req.getReqData().get("phone") ;
			String imgUrl = (String) req.getReqData().get("photo");
			if(StringUtils.isEmpty(imgUrl)) {
				Random random=new Random();
				int sj = random.nextInt(30) + 1;
				imgUrl = "crm/avatars/cl"+sj+".jpg";
			}
			param.put("picture1", imgUrl) ;
			param.put("userPic", imgUrl);
			//根据手机号和unionid判断是否存在 存在修改
			StringBuffer sb = new StringBuffer();
			sb.append("select count(1) cnt from active_user where phone='").append(phone).append("' and unionid='").append(unionid).append("' ");
			int i = this.queryForInt(conn, sb.toString(),new Object[] {});
			if(i>0) {
				param.put("keys", "unionid");
				res = updateTableData(conn, req);
			}else {
				res = insertTableData(conn, req) ;
			}
			if(res.getRetCode()==0) {
				//查询下载资料
				//res = getFile(conn,req) ;
			}
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
		
		}
		return res;
	}
	
	public PageData getFile(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String active_user_uuid = (String) req.getReqData().get("active_user_uuid") ;
			String companyId = (String) req.getReqData().get("companyId") ;
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT jsondata from active_user where uuid = ? ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {active_user_uuid});
			
			StringBuffer sb_con = new StringBuffer(); 
			if(list.size()>0) {
				sb_con.append(" and (") ;
				String jsondata = (String) list.get(0).get("jsondata") ;
				JSONObject jsonObject = (JSONObject) JSON.parse(jsondata);
				for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
				    String value = (String) entry.getValue();
				    if(!StringUtils.isEmpty(value)) {
				    	sb_con.append("INSTR('").append(value).append("',follow)>0 or ") ;
				    }
				}
				sb_con.append(" 1=2) ") ;
			}
			
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT `title`,subtitle,`url` from active_file where companyId = ? ") ;
			sb.append(sb_con) ;
			sb.append(" group by `url` order by title ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {companyId});
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData getCompanyIntroduce(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String chooseuuid = (String)req.getReqData().get("chooseuuid");
			String phone = (String)req.getReqData().get("phone");
			String iscollect = (String)req.getReqData().get("iscollect");
			String openId = (String)req.getReqData().get("openId");
//			String companyId = (String) req.getReqData().get("companyId") ;
//			if(StringUtils.isEmpty(companyId)) {
//				companyId = "45" ;
//			}
			if(StringUtils.isEmpty(chooseuuid)) {
				chooseuuid = "b5935584-2d39-4625-b10e-b1d4a7e91c11" ;
			}
			
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT modeid,uuid,url from t_activity where uuid=? ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {chooseuuid});
			Map<String, Object> map = list.get(0);
			
			//判断url是否为空 为空自己拼一个返回
			if(StringUtils.isEmpty((String) map.get("url"))) {
				String url = Globals.publicActiveAPI+"/#/g_enroll?uuid="+chooseuuid+"&modeid="+map.get("modeid")+"&wxPhone="+phone+"&wxCollect="+iscollect+"&openId="+openId;
				map.put("url", url);
			}else {
				String url = (String) map.get("url") ;
				url = url+"&wxPhone="+phone+"&wxCollect="+iscollect +"&openId="+openId;
				map.put("url", url);
			}
			if(list.size()==1) {
				res.setPage(list);
				res.setRetCode(0);
				res.setRetMessage("OK");
			}else {
				res.setRetCode(1);
				res.setRetMessage("没有查询到该公司资料");
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	
	public PageData getActiveUser(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT if(b.companyId is null or b.companyId='',a.companyId,b.companyId) companyId,a.uuid,a.name,a.phone,a.userPic from active_user a LEFT JOIN t_user b on a.phone=b.phone and b.sfsc=0 where a.unionid = ? limit 1 ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {req.getReqData().get("unionid")});
			for (Map<String, Object> map : list) {
				String imageString = (String) map.get("userPic");
				if (!StringUtils.isEmpty(imageString)) {
					String ossImage = OssUtil.getImgSignURL(imageString,0, Globals.publicBucketName);
					map.put("userPic", ossImage);
				}
			}
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData getActiveSession(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
//			sb.delete(0, sb.length()) ;
//			sb.append(" SELECT uuid,indexTemplate,activityUuid from active_session where sfmr = '1' limit 1  ") ;
//			list = this.queryForList(conn,sb.toString(),new Object[] {});
//			if(list.size()==1) {
//				res.setData(list.get(0));
//				res.setRetCode(0);
//				res.setRetMessage("OK");
//			}else {
//				sb.delete(0, sb.length()) ;
//				sb.append(" SELECT url,id from defaulturl limit 1  ") ;
//				list = this.queryForList(conn,sb.toString(),new Object[] {});
//				if(list.size()==1) {
//					res.setData(list.get(0));
//					res.setRetCode(1);
//					res.setRetMessage("OK");
//				}
//			}
			
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT url,id from defaulturl limit 1  ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {});
			if(list.size()==1) {
				res.setData(list.get(0));
				res.setRetCode(1);
				res.setRetMessage("OK");
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData getActiveList(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		StringBuffer sbfrom = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.append(" select a.companyrule,a.sfgsmb,a.afterAddingImage,a.colorTextObj,a.colorOkBtnObj,a.sfytbxx,a.sfmr,a.companyId,a.isclue,a.uuid,a.`name`,a.cluesource,b.`name` cluesourceName,a.subname,a.starttime,a.endtime,a.companyId,a.jsondata,a.imageBg,a.imgtype,a.images,a.createUid,a.createTime,a.modifyUid,a.modifyTime,a.isdelete,a.modeid " +
					" from t_activity a " +
					" LEFT JOIN t_param b ON a.cluesource=b.value AND b.param_type='13' " +
					" where isdelete <>'1' ") ;
			if (!StringUtils.isEmpty(req.getUinfo().getCompanyId())){
				sb.append(" and a.companyId = '").append(req.getUinfo().getCompanyId()).append("' ") ;
			}
			if (!StringUtils.isEmpty((String)req.getReqData().get("uuid"))){
				sb.append(" and a.uuid = '").append((String)req.getReqData().get("uuid")).append("' ") ;
			}
			sbfrom.append(sb.toString());
			int idx = sbfrom.indexOf(" from ");
			sbfrom.delete(0, idx);
			Page page = new Page(conn,sbfrom.toString(), req.getPageid(), req.getPagesize(), res,new Object[] {});
			sb.append(" order by  a.createTime desc ");
			sb.append(" limit ").append(page.getOffsetlimit()).append(",").append(req.getPagesize());
			list = queryForList(conn,sb.toString(),new Object[] {});
			
			if(list.size()>0 && !StringUtils.isEmpty((String) list.get(0).get("imgtype"))) {
				String images = (String) list.get(0).get("images");
				if("img".equals(list.get(0).get("imgtype"))) {
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("imagesUrl", imageStr);
					}
				}else if("ppt".equals(list.get(0).get("imgtype"))) {
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						list.get(0).put("imagesUrl", imageArr);
					}
				}
				
//				//jsondata解码
//				if(!StringUtils.isEmpty((String) list.get(0).get("jsondata"))) {
//					String decode = URLDecoder.decode((String) list.get(0).get("jsondata"));
//					list.get(0).put("jsondata", decode);
//				}
				
				//背景图片
				if(!StringUtils.isEmpty((String) list.get(0).get("imageBg"))){
					String urlStr = OssUtil.getImgSignURL((String) list.get(0).get("imageBg"), 0);
					list.get(0).put("imageBgUrl",urlStr);
				}else{
					list.get(0).put("imageBgUrl","");
				}
				
				//提交后图片地址
				if(list.size()>0) {
					String afterAddingImage = (String) list.get(0).get("afterAddingImage") ;
					if(!StringUtils.isEmpty(afterAddingImage)){
						
						String urlStr = OssUtil.getImgSignURL((String) list.get(0).get("afterAddingImage"), 0);
						list.get(0).put("afterAddingImageUrl",urlStr);
					}else{
						list.get(0).put("afterAddingImageUrl","");
					}
				}
				
				
			}
			
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
    }
	
	public PageData saveActive(Connection conn,DataReq req) throws UnsupportedEncodingException {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("信息保存失败");
		param.put("tableName", "t_activity");
		param.put("companyId", req.getUinfo().getCompanyId());
		if(StringUtils.isEmpty((String) param.get("starttime"))) {
			param.remove("starttime");
		}
		if(StringUtils.isEmpty((String) param.get("endtime"))) {
			param.remove("endtime");
		}
		//拓展字段用
		String jsondata = (String) param.get("jsondata") ;
		if(!StringUtils.isEmpty(jsondata)) {
			jsondata =  URLDecoder.decode(jsondata, "UTF-8");
			param.put("jsondata", jsondata);
		}
		//拓展字段用
		String colorTextObj = (String) param.get("colorTextObj") ;
		if(!StringUtils.isEmpty(colorTextObj)) {
			colorTextObj =  URLDecoder.decode(colorTextObj, "UTF-8");
			param.put("colorTextObj", colorTextObj);
		}
		//拓展字段用
		String colorOkBtnObj = (String) param.get("colorOkBtnObj") ;
		if(!StringUtils.isEmpty(colorOkBtnObj)) {
			colorOkBtnObj =  URLDecoder.decode(colorOkBtnObj, "UTF-8");
			param.put("colorOkBtnObj", colorOkBtnObj);
		}
		try {
			String sfmr=(String)param.get("sfmr");
			if("1".equals(sfmr)) {
				//update(conn,"update t_activity set sfmr='0' where companyId=? and  sfmr='1' and modeid=? ",new Object[] {req.getUinfo().getCompanyId(),param.get("modeid")}) ;
				
				update(conn,"update t_activity set sfmr='0' where companyId=? and  sfmr='1' ",new Object[] {req.getUinfo().getCompanyId()}) ;
			}
			
			String uuid=(String)param.get("uuid");
			if (uuid ==null || "".equals(uuid)){
				res =  insertTableData(conn, req) ;
			}else{
				param.put("keys","uuid");
				res =  updateTableData(conn, req) ;
			}
			//添加收藏
			UUID collectId = UUID.randomUUID();
			String activeId = res.getKey();
			String phone = req.getUinfo().getPhone();
			StringBuffer sb = new StringBuffer();
			sb.append("insert into t_activity_collect(uuid,activeId,phone) values('"+collectId+"','"+activeId+"','"+phone+"')");
			this.update(conn, sb.toString(),new Object[] {});
			
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
			
		}
		return res;
    }
	
	public PageData delActive(Connection conn,DataReq req) {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("删除失败");
		param.put("tableName", "t_activity");
		param.put("keys","uuid");
		param.put("isdelete", "1");
		try {
			res =  updateTableData(conn, req) ;
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
			
		}
		return res;
    }
	
	public PageData getParamSelect(Connection conn,DataReq req) {
		List<Map<String, Object>> list1 = null ;
		List<Map<String, Object>> list2 = null ;
		PageData res = new PageData();
		try {
			StringBuffer sb = new StringBuffer();
			sb.append(" select type_name from t_param group by type_name ") ;
			list1 = this.queryForList(conn,sb.toString(),new Object[] {});
			
			sb.delete(0, sb.length()) ;
			sb.append(" select type_name,`name`,`value` from t_param ") ;
			list2 = this.queryForList(conn,sb.toString(),new Object[] {});
			
			for(int i=0;i<list1.size();i++){
				List<Map<String, Object>> allList = new ArrayList<Map<String, Object>>();
				for (Map<String, Object> tmp : list2) {
					Map<String, Object> map = new LinkedHashMap<String, Object>();
					if(list1.get(i).get("type_name").equals(tmp.get("type_name"))){
						map.put("value", tmp.get("value"));
						map.put("name", tmp.get("name"));
						allList.add(map);
					}
				}
				list1.get(i).put("child", allList);
			}
			res.setPage(list1);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
    }
	
	public PageData saveActiveUser(Connection conn,DataReq req) throws SQLException {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("参数信息保存失败");
		param.put("tableName", "active_user");
		param.put("yhlb", "03");
		param.put("isLog", "0");
		String uuid=(String)param.get("uuid");

			//查询公司信息
			StringBuffer sb = new StringBuffer();
			sb.append(" select companyId,cluesource from t_activity where uuid= '").append((String)param.get("activityUuid")).append("' ") ;
			List<Map<String, Object>> list = this.queryForList(conn,sb.toString(),new Object[] {});
			param.put("companyId", list.get(0).get("companyId"));
			
			Map<String, String> phoneAddress = HttpUtils.getPhoneAddress((String) param.get("phone"));
			String numberhome = phoneAddress.get("province")+" "+phoneAddress.get("city"); //号码归属地
			//判断是否插入线索
			String isclue = (String) param.get("isclue");
			if("1".equals(isclue)){
				String jsondata=(String)param.get("jsondata");
				JSONObject jsonObject = (JSONObject) JSON.parse(jsondata);
				String cluecompany = "" ;
				if(jsonObject!=null) {
					 cluecompany = (String) jsonObject.get("公司名称") ;
				}

				sb.delete(0, sb.length()) ;
				sb.append(" select * from clue where isdelete = 0 and advertisementId= ? and cluephone = ? ") ;
				List<Map<String, Object>> list2 = this.queryForList(conn,sb.toString(),new Object[] {(String)param.get("activityUuid"), (String)param.get("phone")});
				String activeType = (String) param.get("activeType");
				if (StrUtil.isNotEmpty(activeType) && activeType.equals("ldy") && !list2.isEmpty()) {
					res.setRetCode(1);
					res.setRetMessage("一个手机号只能参与一次活动！");
					return res;
				}

				param.put("tableName", "clue");
				param.put("advertisementId", (String)param.get("activityUuid"));
				param.put("openid", (String)param.get("openId"));
				param.put("companycontact", (String) param.get("name"));
				param.put("cluephone", (String) param.get("phone"));
				param.put("numberhome", numberhome);
				param.put("cluecompany", cluecompany);
				param.put("cluebelongtocompany", list.get(0).get("companyId"));
				param.put("cluesource", list.get(0).get("cluesource"));
				param.put("isdelete", "0");
				res =  insertTableData(conn, req) ;


				param.put("tableName", "active_user");
				param.put("uuid", uuid);
			}
			
			//是否需要验证码
			String sfxyyzm=(String) param.get("sfxyyzm");
			if ("1".equals(sfxyyzm)){
				//不需要
			}else{
				//判断验证码是否正确
				String phone = (String) param.get("phone");
				String code = (String) param.get("code");
//				boolean validCode = ValidCodeUtil.validCode(phone, code);
//				if(!validCode) {
//					res.setRetCode(1);
//		            res.setRetMessage("验证码输入错误!");
//		            return res;
//				}
				UserConnDaoImpl userConnDaoImpl=new UserConnDaoImpl();
				long validCode =userConnDaoImpl.VerificationCode(phone,code);
				if(validCode==0) {
					res.setRetCode(1);
		            res.setRetMessage("验证码输入错误!");
		            return res;
				}else if(validCode<0){
					res.setRetCode(1);
		            res.setRetMessage("验证码过期!");
		            return res;
				}
				
			}
			
			if (uuid ==null || "".equals(uuid)){

				Random random=new Random();
				int sj = random.nextInt(30) + 1;
				String imgUrl = "crm/avatars/cl"+sj+".jpg";
				param.put("userPic", imgUrl) ;
				System.out.println("落地页活动，添加用户时，默认创建用户头像！！！！！");
				res =  insertTableData(conn, req) ;
			}else{
				param.put("keys","uuid");
				res =  updateTableData(conn, req) ;
			}
		
		return res;
    }
	
	public PageData getActiveByUuid(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.append(" select  a.companyrule,c.companyName,a.sfgsmb,a.afterAddingImage,a.colorTextObj,a.colorOkBtnObj,a.sfytbxx,a.sfmr,a.companyId,a.isclue,a.uuid,a.`name`,a.cluesource,b.`name` cluesourceName,a.subname,a.starttime,a.endtime,a.companyId,a.jsondata,a.imageBg,a.imgtype,a.images,a.createUid,a.createTime,a.modifyUid,a.modifyTime,a.isdelete,a.modeid " +
					" from t_activity a INNER JOIN t_company c on a.companyId=c.companyId " +
					" LEFT JOIN t_param b ON a.cluesource=b.value AND b.param_type='13' " +
					" where isdelete <>'1' ") ;
			sb.append(" and a.uuid = '").append((String)req.getReqData().get("uuid")).append("' ") ;
			list = queryForList(conn,sb.toString(),new Object[] {});
			
			//jsondata解码
//			if(!StringUtils.isEmpty((String) list.get(0).get("jsondata"))) {
//				String decode = URLDecoder.decode((String) list.get(0).get("jsondata"));
//				list.get(0).put("jsondata", decode);
//			}
			
			String images = (String) list.get(0).get("images");
			if("img".equals(list.get(0).get("imgtype"))) {
				if(images != null && !"".equals(images)) {
					String[] imageArr = images.split(";");
					List<String> imageStr = new ArrayList<String>();
					for(int i=0;i<imageArr.length;i++) {
						String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
						imageStr.add(urlStr);
					}
					list.get(0).put("imagesUrl", imageStr);
				}
			}else if("ppt".equals(list.get(0).get("imgtype"))) {
				if(images != null && !"".equals(images)) {
					String[] imageArr = images.split(";");
					list.get(0).put("imagesUrl", imageArr);
				}
			}
			
			//背景图片
			if(!StringUtils.isEmpty((String) list.get(0).get("imageBg"))){
				String urlStr = OssUtil.getImgSignURL((String) list.get(0).get("imageBg"), 0);
				list.get(0).put("imageBgUrl",urlStr);
			}else{
				list.get(0).put("imageBgUrl","");
			}
			
			//提交后图片地址
			if(list.size()>0) {
				String afterAddingImage = (String) list.get(0).get("afterAddingImage") ;
				if(!StringUtils.isEmpty(afterAddingImage)){
					String urlStr = OssUtil.getImgSignURL((String) list.get(0).get("afterAddingImage"), 0);
					list.get(0).put("afterAddingImageUrl",urlStr);
				}else{
					list.get(0).put("afterAddingImageUrl","");
				}
			}

			
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
    }
	
	public PageData getWxUser(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String openId = (String) req.getReqData().get("openId") ;
			String phone = (String) req.getReqData().get("phone") ;
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT companyId,createUid,nickName from t_user where openid = ? and sfsc=0 limit 1 ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {openId});
			if(list.size()==0) {
				sb.delete(0, sb.length()) ;
				sb.append(" SELECT companyId,createUid,nickName from t_user where phone = ? and sfsc=0 limit 1 ") ;
				list = this.queryForList(conn,sb.toString(),new Object[] {phone});
			}
			if(list.size()==0) {
				res.setPage(list);
				res.setRetCode(0);
				res.setRetMessage("OK");
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData getWxUser_Custom(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String openId = (String) req.getReqData().get("openId") ;
			String active_uuid = (String) req.getReqData().get("active_uuid") ;
			
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT a.companyId,a.uuid,a.name,a.phone from active_user a  where a.openid = ? limit 1 ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {openId});
			if(list.size()==0) {
				res.setRetCode(9);
				res.setRetMessage("没有查询到该参与用户");
				return res ;
			}
			
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT a.companyId,activeName,uuid from active_custom a  where a.uuid = ? limit 1 ") ;
			List<Map<String, Object>> listTmp = this.queryForList(conn,sb.toString(),new Object[] {active_uuid});
			if(listTmp.size()==0) {
				res.setRetCode(9);
				res.setRetMessage("没有查询到活动");
				return res ;
			}
			
			if(listTmp.size()>0 && list.size()>0) {
				list.get(0).put("companyId", listTmp.get(0).get("companyId")) ;
				list.get(0).put("activeName", listTmp.get(0).get("activeName")) ;
				list.get(0).put("uuid", listTmp.get(0).get("uuid")) ;
			}
			
			
			if(list.size()>0) {
				res.setPage(list);
				res.setRetCode(0);
				res.setRetMessage("OK");
			}
			
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData isParticipateIn(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String openId = (String) req.getReqData().get("openId") ;
			String active_uuid = (String) req.getReqData().get("active_uuid") ;
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT a.companyId,a.uuid,a.name,a.phone from active_user a INNER  JOIN  clue b on a.phone=b.cluephone and  b.advertisementId=? where a.openid = ? limit 1 ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {active_uuid,openId});
			if(list.size()>0) {
				//res.setPage(list);
				res.setRetCode(0);
				res.setRetMessage("OK");
			}

			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData getActivityCount(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			String openId = (String) req.getReqData().get("openId") ;
			String active_uuid = (String) req.getReqData().get("active_uuid") ;
			
			//参与人数
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT count(1)+958 cnt from clue where advertisementId = ? ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {active_uuid});
			String cnt = "0" ;
			if(list.size()>0) {
				cnt = list.get(0).get("cnt").toString() ;
			}

			//转发次数
			sb.delete(0, sb.length()) ;
			sb.append(" SELECT count(1) cnt from forward_record_tree_path where activeId = ? and ancestor=? and depth=2 ") ;
			list = this.queryForList(conn,sb.toString(),new Object[] {active_uuid,openId});
			String cnt_zf = "0" ;
			if(list.size()>0) {
				cnt_zf = list.get(0).get("cnt").toString() ;
			}
			
			Map<String,Object> item = new LinkedHashMap<String, Object>() ;
			item.put("cnt", cnt) ;
			item.put("cnt_zf", cnt_zf) ;
			res.setData(item);
			res.setRetCode(0);
			res.setRetMessage("OK");
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}
	
	public PageData addUsersLoginInfo(Connection conn,DataReq req) {
		Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		param.put("tableName", "t_autologin");
		param.put("tokenID", req.getReqData().get("id"));
		if(StringUtils.isEmpty((String)param.get("tokenID"))) {
			res.setRetCode(9);
			res.setRetMessage("登录ID不能为空！");
			return res ;
		}
		try {
			res =  insertTableData(conn, req) ;
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
		
		}
		return res;
	}
	
	public PageData saveCollectRecord(Connection conn,DataReq req) {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("资料收藏失败");
		param.put("tableName", "t_activity_collect");
		
		try {
			String isCollect = (String) param.get("isCollect");
			if("1".equals(isCollect)) {
				PageData sqlInfo = getInsertSQL(conn, req);
				if (sqlInfo.getRetCode() != 0) {
					return sqlInfo;
				}
				final StringBuffer sb_field = (StringBuffer) sqlInfo.getData().get("sb_field");
				final List<String> listData = (List<String>) sqlInfo.getData().get("listData");
				int i = this.update(conn, sb_field.toString(), listData.toArray());
			}else {
				StringBuffer sb = new StringBuffer();
				sb.append("delete from t_activity_collect where activeId='")
				.append(param.get("activeId")).append("'")
				.append(" and phone='").append(param.get("phone")).append("' ");
				this.update(conn, sb.toString(), new Object[] {});
			}

			conn.commit();
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
			
		}
		return res;
    }
	
	public PageData getPersonalCollect(Connection conn,DataReq req,HttpServletRequest request) {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("获取个人收藏失败");
		StringBuffer sb = new StringBuffer();
		StringBuffer sbfrom = new StringBuffer();
		try {
			sb.append("select * from (");
			sb.append("select b.uuid,b.name,b.companyId,d.companyName,b.modeid,SUBSTRING_INDEX(b.images,';',1) cover,a.createTime,1 type,1 isCollect\r\n"
					+ " from t_activity_collect a\r\n"
					+ "inner join t_activity b on a.activeId=b.uuid \r\n"
					+ "left join active_user c on a.phone=c.phone and c.phone='"+param.get("phone")+"'\r\n"
					+ "left join t_company d on b.companyId=d.companyId "
					+ " where b.isdelete!='1' and a.phone='"+param.get("phone")+"' and b.modeid='nesturn001' and b.endtime>=now() ");
			if(!StringUtils.isEmpty((String) param.get("name"))) {
				sb.append(" and (b.name like '%").append(param.get("name")).append("%' or d.companyName like '%").append(param.get("name")).append("%') ");
			}
			sb.append("GROUP BY a.activeId ");
//			sb.append(" union \r\n"
//					+ "select  b.uuid,b.name,b.companyId,c.companyName,b.modeid,SUBSTRING_INDEX(b.images,';',1) cover,b.createTime, 2 type,0 isCollect\r\n"
//					+ "from active_user a\r\n"
//					+ "left join t_activity b on a.companyId=b.companyId\r\n"
//					+ "left join t_company c on b.companyId=c.companyId "
//					+ "where b.isdelete!='1' and a.phone='"+param.get("phone")+"' and b.modeid='nesturn001' \r\n");
//			if(!StringUtils.isEmpty((String) param.get("name"))) {
//				sb.append(" and (b.name like '%").append(param.get("name")).append("%' or c.companyName like '%").append(param.get("name")).append("%') ");
//			}
//			sb.append("group by b.uuid");
			sb.append(") l ");
			if(!StringUtils.isEmpty((String) param.get("uuid"))) {
				sb.append(" where l.uuid='").append(param.get("uuid")).append("' and l.type='1' ");
			}
			sb.append("order by l.type asc, l.createTime desc ");
			System.out.println(sb);
			//sb = DBUtils.sql_check(sb) ;
			sbfrom.append(sb.toString()) ;
			int idx=sbfrom.indexOf(" from ") ;
			sbfrom.delete(0, idx);
			Page page = new Page(conn,sbfrom.toString(),req.getPageid(),req.getPagesize(),res,new Object[]{}) ;
			sb.append(" limit ").append(page.getOffsetlimit()).append(",").append(req.getPagesize()) ;
			List<Map<String, Object>> list = this.queryForList(conn, sb.toString(), new Object[] {});
			for(int i=0;i<list.size();i++) {
				String cover = (String) list.get(i).get("cover");
				if(!StringUtils.isEmpty(cover)) {
					if(cover.startsWith("nesoss")) {
						String urlStr = OssUtil.getImgSignURL(cover, 0);
						list.get(i).put("cover", urlStr);
					}else if(cover.startsWith("/TServImage")) {
						String basePath = request.getScheme()+"://"+request.getServerName()+":"+
				                request.getServerPort();
						list.get(i).put("cover", basePath+cover);
					}
				}
			}
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
			
		}
		return res;
    }
	
	public PageData getRecommendData(Connection conn,DataReq req,HttpServletRequest request) {
    	Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("获取推荐资料失败");
		StringBuffer sb = new StringBuffer();
		StringBuffer sbfrom = new StringBuffer();
		try {
			sb.append("select l.* from ("
					+ "select a.uuid,a.name,a.companyId,d.companyName,a.modeid,SUBSTRING_INDEX(a.images,';',1) cover,a.createTime,a.jsondata,0 isFlag,if(e.uuid is not null ,1,0) isCollect\r\n" //if(f.phone='"+param.get("phone")+"' || (count(c.uuid)>0 and count(c.uuid) is not null) ,0,1)
					+ " from t_activity a\r\n"
					+ "inner join (\r\n"
					+ "select b.companyId,a.phone\r\n"
					+ "from t_activity_collect a\r\n"
					+ "left join t_activity b on a.activeId=b.uuid and b.modeid='nesturn001'\r\n"
					+ "where a.phone='"+ param.get("phone")+"' \r\n"
					+ "group by b.companyId\r\n"
					+ ") b on a.companyId=b.companyId and a.modeid='nesturn001'\r\n"
					+ "left join active_user c on a.companyId=c.companyId and b.phone=c.phone and yhlb='03'\r\n"
					+ "left join t_company d on a.companyId=d.companyId "
					+ "left join t_activity_collect e on a.uuid=e.activeId and e.phone='" + param.get("phone")+ "' "
					+ "left join t_user f on a.createUid=f.id "
					+ "where a.isdelete!='1' and a.modeid='nesturn001'  and a.endtime>=now()  ");
			if(!StringUtils.isEmpty((String) param.get("name"))) {
				sb.append(" and (a.name like '%").append(param.get("name")).append("%' or d.companyName like '%").append(param.get("name")).append("%') ");
			}
			sb.append("group by a.uuid\r\n");
			sb.append(" union select a.uuid,a.name,a.companyId,d.companyName,a.modeid,SUBSTRING_INDEX(a.images,';',1) cover,a.createTime,a.jsondata,0 isFlag,if(e.uuid is not null ,1,0) isCollect\r\n" //if(b.phone='"+param.get("phone")+"' || (count(c.uuid)>0 and count(c.uuid) is not null) ,0,1) isFlag
					+ "from t_activity a\r\n"
					+ "left join t_user b on a.createUid=b.id\r\n"
					+ "left join active_user c on a.companyId=c.companyId and b.phone=c.phone and c.yhlb='03'\r\n"
					+ "left join t_company d on a.companyId=d.companyId\r\n"
					+ "left join t_activity_collect e on a.uuid=e.activeId and e.phone='"+param.get("phone")+"'\r\n"
					+ "where a.isdelete!=1 and b.phone='"+param.get("phone")+"'  and a.endtime>=now() "
					+ " group by a.uuid ) l");
			sb.append(" order by l.createTime ");
//			sb = DBUtils.sql_check(sb) ;
			sbfrom.append(sb.toString()) ;
			int idx=sbfrom.indexOf(" from ") ;
			sbfrom.delete(0, idx);
//			sbfrom.insert(0," from ( select count(1) cnt ");
//            sbfrom.append(") l");
			Page page = new Page(conn,sbfrom.toString(),req.getPageid(),req.getPagesize(),res,new Object[]{}) ;
			sb.append(" limit ").append(page.getOffsetlimit()).append(",").append(req.getPagesize()) ;
			List<Map<String, Object>> list = this.queryForList(conn, sb.toString(), new Object[] {});
			for(int i=0;i<list.size();i++) {
				String cover = (String) list.get(i).get("cover");
				if(!StringUtils.isEmpty(cover)) {
					if(cover.startsWith("nesoss")) {
						String urlStr = OssUtil.getImgSignURL(cover, 0);
						list.get(i).put("cover", urlStr);
					}else if(cover.startsWith("/TServImage")) {
						String basePath = request.getScheme()+"://"+request.getServerName()+":"+
				                request.getServerPort();
						list.get(i).put("cover", basePath+cover);
					}
				}
			}
			
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {
			
		}
		return res;
    }

	public PageData getPosterList(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		StringBuffer sbfrom = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.append(" select a.*,b.`name` cluesourceName from poster a \n" +
					" left join t_param b on a.cluesource=b.`value` and b.param_type='13' \n" +
					" where isdelete <>'1' ") ;
			if (!StringUtils.isEmpty(req.getUinfo().getCompanyId())){
				sb.append(" and a.companyId = '").append(req.getUinfo().getCompanyId()).append("' ") ;
			}
			sbfrom.append(sb.toString());
			int idx = sbfrom.indexOf(" from ");
			sbfrom.delete(0, idx);
			Page page = new Page(conn,sbfrom.toString(), req.getPageid(), req.getPagesize(), res,new Object[] {});
			sb.append(" order by a.createTime desc ");
			sb.append(" limit ").append(page.getOffsetlimit()).append(",").append(req.getPagesize());
			list = queryForList(conn,sb.toString(),new Object[] {});
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}

	public PageData getPosterDetail(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.append(" select * from poster where isdelete <>'1' ") ;
			if (!StringUtils.isEmpty((String)req.getReqData().get("uuid"))){
				sb.append(" and uuid = '").append((String)req.getReqData().get("uuid")).append("' ") ;
			}
			list = queryForList(conn,sb.toString(),new Object[] {});
			if(list.size()>0) {
				if(!StringUtils.isEmpty((String) list.get(0).get("shareimg"))){
					String images = (String) list.get(0).get("shareimg");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("shareimgMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("headimg"))){
					String images = (String) list.get(0).get("headimg");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("headimgMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("bgimg"))){
					String images = (String) list.get(0).get("bgimg");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("bgimgMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("imgbtn"))){
					String images = (String) list.get(0).get("imgbtn");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("imgbtnMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("imglist"))){
					String images = (String) list.get(0).get("imglist");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("imglistMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("codeimg"))){
					String images = (String) list.get(0).get("codeimg");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("codeimgMap", imageStr);
					}
				}
				if(!StringUtils.isEmpty((String) list.get(0).get("codebgimg"))){
					String images = (String) list.get(0).get("codebgimg");
					if(images != null && !"".equals(images)) {
						String[] imageArr = images.split(";");
						List<String> imageStr = new ArrayList<String>();
						for(int i=0;i<imageArr.length;i++) {
							String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
							imageStr.add(urlStr);
						}
						list.get(0).put("codebgimgMap", imageStr);
					}
				}
			}
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}

	public PageData savePoster(Connection conn,DataReq req) throws UnsupportedEncodingException {
		Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("信息保存失败");
		param.put("tableName", "poster");
		param.put("companyId", req.getUinfo().getCompanyId());
		try {
			String uuid=(String)param.get("uuid");
			if (uuid ==null || "".equals(uuid)){
				res =  insertTableData(conn, req) ;
			}else{
				param.put("keys","uuid");
				res =  updateTableData(conn, req) ;
			}
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {

		}
		return res;
	}

	public PageData delPoster(Connection conn,DataReq req) {
		Map<String, Object> param = req.getReqData();
		PageData res = new PageData();
		res.setRetCode(9);
		res.setRetMessage("删除失败");
		param.put("tableName", "poster");
		param.put("keys","uuid");
		param.put("isdelete", "1");
		try {
			res =  updateTableData(conn, req) ;

			// 删除动态按钮信息
			DelPosterButtonInfoVO delPosterButtonInfoVO = new DelPosterButtonInfoVO();
			delPosterButtonInfoVO.setPosterUuid((String) param.get("uuid"));
			delPosterButtonInfoVO.setUserInfo(req.getUinfo());
			newH5Service.delPosterButtonInfo(delPosterButtonInfoVO);
		} catch (Exception e) {
			res.setRetCode(9);
			res.setRetMessage("操作失败！");
			e.printStackTrace();
		} finally {

		}
		return res;
	}

	public PageData getPosterList_xcx(Connection conn,DataReq req) {
		StringBuffer sb = new StringBuffer();
		StringBuffer sbfrom = new StringBuffer();
		List<Map<String, Object>> list = null ;
		PageData res = new PageData();
		try {
			sb.append(" select a.*,b.`name` cluesourceName from poster a \n" +
					" left join t_param b on a.cluesource=b.`value` and b.param_type='13' \n" +
					" where isdelete <>'1' ") ;
			sbfrom.append(sb.toString());
			int idx = sbfrom.indexOf(" from ");
			sbfrom.delete(0, idx);
			Page page = new Page(conn,sbfrom.toString(), req.getPageid(), req.getPagesize(), res,new Object[] {});
			sb.append(" order by a.createTime desc ");
			sb.append(" limit ").append(page.getOffsetlimit()).append(",").append(req.getPagesize());
			list = queryForList(conn,sb.toString(),new Object[] {});
			if(list.size()>0) {
				for(int j=0;j< list.size();j++){
					if(!StringUtils.isEmpty((String) list.get(j).get("shareimg"))){
						String images = (String) list.get(j).get("shareimg");
						if(images != null && !"".equals(images)) {
							String[] imageArr = images.split(";");
							List<String> imageStr = new ArrayList<String>();
							for(int i=0;i<imageArr.length;i++) {
								String urlStr = OssUtil.getImgSignURL(imageArr[i], 0);
								imageStr.add(urlStr);
							}
							list.get(j).put("shareimgMap", imageStr);
						}
					}
				}
			}
			res.setPage(list);
			res.setRetCode(0);
			res.setRetMessage("OK");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return res;
	}

}